<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .active{
            color: #999999;
            border: 1px solid red;
            width: 100px;
            height: 100px;
        }
        .error{
            background-color: orange;
        }
        [v-cloak] {
            display: none;
        }
        .test{
            color: blue;
        }
        .base{
            font-size: 20px;
        }
    </style>
</head>
<body>
    <h2>Vue样式的绑定---style样式处理</h2>
        <div id="app">
           <div v-bind:style='{border: borderStyle,width: widthStyle,height: heightStyle}'></div>
           <button @click="handle">切换</button>
           <div :style='objStyles'></div><br>
           <div :style="[objStyles,overrideStyles]"></div>
        </div>
</body>
<script src="./js/vue.js"></script>
<script>
    /*
        总结：
                style样式处理有两种形式
                    对象语法
                    数组语法
    */
    var vm = new Vue({
        el: '#app',
        data: {
            borderStyle: '1px solid blue',
            widthStyle:  '100px',
            heightStyle:  '200px',
            objStyles: {
                border: '1px solid blue',
                width:   '200px',
                height:  '100px'
            },
            overrideStyles:{
                border: '5px solid orange',
                backgroundColor: 'blue'
            }
        },
        methods:{
            handle:function(){
                //控制 样式的切换
                this.heightStyle = '100px',
                this.objStyles.width = '100px'
            }
        }
    })
</script>
</html>